class Article < ActiveRecord::Base
	belongs_to :department
  acts_as_list :column=>:id ,:scope => :department_id
  
  has_many :revision_records, :order => :reviewdate
	
	validates_presence_of :articletitle, :author, :department_id
	validates_uniqueness_of :articletitle
	
	def self.find_articles
    find(:all, :order=>"receiveddate", :include =>[:revision_records])
	end
  
	def self.find_articles_by_receiveddate ( from , to)
    
    find(:all, :order=>"receiveddate",
               :conditions => ["receiveddate>= :from and receiveddate <= :to",{:from => from, :to => to}],
               :include =>[:revision_records])
	end
end
